package com.goodmr.passport.device;

import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * 帐号绑定设备信息
 *
 * @author <a href="mailto:bingdong13@msn.com">bigo</a>
 */
@Entity
@Table(name = "device")
@Data
class DeviceEntity implements Serializable {

    private static final long serialVersionUID = -1694747583829308247L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 帐号ID
     */
    @Column(name = "account_id", length = 20, nullable = false)
    private Long accountId;

    /**
     * 设备名称（Web，Webapp, Android，iOS）
     */
    @Column(length = 20, nullable = false)
    private String name;

    /**
     * 设备token
     */
    @Column(nullable = false)
    private String token;

    /**
     * 是否通过安全认证，0未认证，1已认证
     */
    @Column(name = "is_secured", length = 3, nullable = false)
    private Integer isSecured;

    /**
     * 创建时间
     */
    @Column(name = "created_at", nullable = false, updatable = false)
    private Timestamp createdAt;

    /**
     * 更新时间
     */
    @Column(name = "updated_at", nullable = false)
    private Timestamp updatedAt;
}
